.class public Lcom/instagram/android/util/c;
.super Ljava/lang/Object;
.source "AutoUpdateHelper.java"


# instance fields
.field private a:Landroid/content/Context;

.field private b:Landroid/content/SharedPreferences;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 3
    .parameter

    .prologue
    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 39
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/util/c;->a:Landroid/content/Context;

    .line 40
    iget-object v0, p0, Lcom/instagram/android/util/c;->a:Landroid/content/Context;

    const-string v1, "autoUpdatePreferences"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/util/c;->b:Landroid/content/SharedPreferences;

    .line 41
    return-void
.end method

.method static synthetic a(Lcom/instagram/android/util/c;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 28
    iget-object v0, p0, Lcom/instagram/android/util/c;->a:Landroid/content/Context;

    return-object v0
.end method

.method private a(Landroid/support/v4/app/j;)V
    .locals 3
    .parameter

    .prologue
    .line 133
    new-instance v0, Lcom/instagram/ui/a/a;

    invoke-direct {v0, p1}, Lcom/instagram/ui/a/a;-><init>(Landroid/content/Context;)V

    sget v1, Lcom/facebook/ba;->autoupdater_no_upgrade_available:I

    invoke-virtual {v0, v1}, Lcom/instagram/ui/a/a;->b(I)Lcom/instagram/ui/a/a;

    move-result-object v0

    sget v1, Lcom/facebook/ba;->autoupdater_up_to_date:I

    invoke-virtual {v0, v1}, Lcom/instagram/ui/a/a;->a(I)Lcom/instagram/ui/a/a;

    move-result-object v0

    sget v1, Lcom/facebook/ba;->ok:I

    new-instance v2, Lcom/instagram/android/util/f;

    invoke-direct {v2, p0}, Lcom/instagram/android/util/f;-><init>(Lcom/instagram/android/util/c;)V

    invoke-virtual {v0, v1, v2}, Lcom/instagram/ui/a/a;->a(ILandroid/content/DialogInterface$OnClickListener;)Lcom/instagram/ui/a/a;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/instagram/ui/a/a;->a(Z)Lcom/instagram/ui/a/a;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/ui/a/a;->b()Landroid/app/Dialog;

    move-result-object v0

    invoke-virtual {v0}, Landroid/app/Dialog;->show()V

    .line 144
    return-void
.end method

.method private a(Landroid/support/v4/app/j;Landroid/support/v4/app/aj;Lcom/instagram/android/util/g;)V
    .locals 3
    .parameter
    .parameter
    .parameter

    .prologue
    .line 84
    new-instance v0, Lcom/instagram/android/util/d;

    invoke-direct {v0, p0, p1, p3}, Lcom/instagram/android/util/d;-><init>(Lcom/instagram/android/util/c;Landroid/support/v4/app/j;Lcom/instagram/android/util/g;)V

    .line 110
    const-string v1, "AutoUpdateHelper"

    const-string v2, "Checking if new version is available"

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 111
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    invoke-virtual {p0, v1, v2}, Lcom/instagram/android/util/c;->a(J)V

    .line 112
    new-instance v1, Lcom/instagram/android/d/e/c;

    invoke-direct {v1, p1, p2, v0}, Lcom/instagram/android/d/e/c;-><init>(Landroid/content/Context;Landroid/support/v4/app/aj;Lcom/instagram/android/d/j/a;)V

    .line 113
    invoke-virtual {v1}, Lcom/instagram/android/d/e/c;->g()V

    .line 114
    return-void
.end method

.method private a(Landroid/support/v4/app/j;Ljava/lang/String;)V
    .locals 4
    .parameter
    .parameter

    .prologue
    .line 118
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.VIEW"

    invoke-static {p2}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v2

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 119
    new-instance v1, Lcom/instagram/ui/a/a;

    invoke-direct {v1, p1}, Lcom/instagram/ui/a/a;-><init>(Landroid/content/Context;)V

    sget v2, Lcom/facebook/ba;->autoupdater_upgrade_available:I

    invoke-virtual {v1, v2}, Lcom/instagram/ui/a/a;->b(I)Lcom/instagram/ui/a/a;

    move-result-object v1

    sget v2, Lcom/facebook/ba;->autoupdater_new_version:I

    invoke-virtual {v1, v2}, Lcom/instagram/ui/a/a;->a(I)Lcom/instagram/ui/a/a;

    move-result-object v1

    sget v2, Lcom/facebook/ba;->autoupdater_install:I

    new-instance v3, Lcom/instagram/android/util/e;

    invoke-direct {v3, p0, p1, v0}, Lcom/instagram/android/util/e;-><init>(Lcom/instagram/android/util/c;Landroid/support/v4/app/j;Landroid/content/Intent;)V

    invoke-virtual {v1, v2, v3}, Lcom/instagram/ui/a/a;->a(ILandroid/content/DialogInterface$OnClickListener;)Lcom/instagram/ui/a/a;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/instagram/ui/a/a;->a(Z)Lcom/instagram/ui/a/a;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/ui/a/a;->b()Landroid/app/Dialog;

    move-result-object v0

    invoke-virtual {v0}, Landroid/app/Dialog;->show()V

    .line 130
    return-void
.end method

.method static synthetic a(Lcom/instagram/android/util/c;Landroid/support/v4/app/j;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 28
    invoke-direct {p0, p1}, Lcom/instagram/android/util/c;->a(Landroid/support/v4/app/j;)V

    return-void
.end method

.method static synthetic a(Lcom/instagram/android/util/c;Landroid/support/v4/app/j;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter
    .parameter

    .prologue
    .line 28
    invoke-direct {p0, p1, p2}, Lcom/instagram/android/util/c;->a(Landroid/support/v4/app/j;Ljava/lang/String;)V

    return-void
.end method


# virtual methods
.method public a(J)V
    .locals 2
    .parameter

    .prologue
    .line 65
    iget-object v0, p0, Lcom/instagram/android/util/c;->b:Landroid/content/SharedPreferences;

    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    const-string v1, "last_request_time"

    invoke-interface {v0, v1, p1, p2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 66
    return-void
.end method

.method public a(Landroid/support/v4/app/j;Landroid/support/v4/app/aj;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 70
    invoke-virtual {p0}, Lcom/instagram/android/util/c;->a()Z

    move-result v0

    if-nez v0, :cond_0

    .line 74
    :goto_0
    return-void

    .line 73
    :cond_0
    sget-object v0, Lcom/instagram/android/util/g;->a:Lcom/instagram/android/util/g;

    invoke-direct {p0, p1, p2, v0}, Lcom/instagram/android/util/c;->a(Landroid/support/v4/app/j;Landroid/support/v4/app/aj;Lcom/instagram/android/util/g;)V

    goto :goto_0
.end method

.method public a()Z
    .locals 9

    .prologue
    const/4 v0, 0x0

    .line 44
    invoke-virtual {p0}, Lcom/instagram/android/util/c;->b()Z

    move-result v1

    if-nez v1, :cond_0

    .line 51
    :goto_0
    return v0

    .line 47
    :cond_0
    invoke-virtual {p0}, Lcom/instagram/android/util/c;->c()J

    move-result-wide v1

    .line 48
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    .line 49
    sub-long v5, v3, v1

    const-wide/32 v7, 0x1499700

    cmp-long v5, v5, v7

    if-lez v5, :cond_1

    const/4 v0, 0x1

    .line 50
    :cond_1
    const-string v5, "AutoUpdateHelper"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Check? "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " Last check: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " Now: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v5, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public b(Landroid/support/v4/app/j;Landroid/support/v4/app/aj;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 78
    sget-object v0, Lcom/instagram/android/util/g;->b:Lcom/instagram/android/util/g;

    invoke-direct {p0, p1, p2, v0}, Lcom/instagram/android/util/c;->a(Landroid/support/v4/app/j;Landroid/support/v4/app/aj;Lcom/instagram/android/util/g;)V

    .line 79
    return-void
.end method

.method public b()Z
    .locals 2

    .prologue
    .line 55
    invoke-static {}, Lcom/instagram/i/a;->c()Z

    move-result v0

    .line 56
    invoke-static {}, Lcom/instagram/android/g/b;->a()Lcom/facebook/a/b;

    move-result-object v1

    invoke-virtual {v1}, Lcom/facebook/a/b;->b()Z

    move-result v1

    .line 57
    if-eqz v0, :cond_0

    if-eqz v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public c()J
    .locals 4

    .prologue
    .line 61
    iget-object v0, p0, Lcom/instagram/android/util/c;->b:Landroid/content/SharedPreferences;

    const-string v1, "last_request_time"

    const-wide/16 v2, 0x0

    invoke-interface {v0, v1, v2, v3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    return-wide v0
.end method
